﻿window.onload = function () {
    if (action == "update") {//修改
        $("#Atv_date").attr("readonly", "readonly").removeAttr("onclick").removeClass("Wdate");
    } else if (action == "insert") {//添加
        var recordID = window.parent.myDataTable.getSelectedRows()[0];
        record = window.parent.myDataTable.getRecord(recordID);
        $("#Atv_cust_no").val(record._oData.ID);
        $("#Atv_cust_name").val(record._oData.Cust_name);
        $("#CreatedOn").val(CurentTime());
    }

}
var fnCheckData = function () {
    try {

        if ($("#Atv_date").val() == "") {
            return "交往时间不能为空！";
        }
    }
    catch (e)
     { alert(e.ToString()); }
}

//获取当前时间
function CurentTime() {
    var now = new Date();

    var year = now.getFullYear();       //年
    var month = now.getMonth() + 1;     //月
    var day = now.getDate();            //日

    var hh = now.getHours();            //时
    var mm = now.getMinutes();          //分
    var ss = now.getSeconds();          //秒

    var clock = year + "-" + month + "-" + day + " " + hh + ":" + mm + ":" + ss;
    return (clock);
} 